from PySide6.QtWidgets import QApplication, QComboBox, QVBoxLayout, QWidget, QFormLayout, QLineEdit, QLabel, QPushButton

import sys

class MyWindow(QWidget):
    def __init__(self) -> None:
        super().__init__()
        self.setWindowTitle("03_QLayout_布局补充")
        # 1. QFormLayout 表单布局，方便快生成Form表单
        self.formLayout = QFormLayout()
        self.formLayout.addRow(QLabel('========= QFormLayout ========='))
        self.formLayout.addRow('用户名', QLineEdit())
        self.formLayout.addRow(QLabel('密码'), QLineEdit())
        self.formLayout.addWidget(QPushButton('登录'))
        
        # 可以这样直接设置布局，也可嵌套在其他布局里面
        # self.setLayout(self.formLayout)
        
        layout = QVBoxLayout()
        layout.addLayout(self.formLayout)
        self.setLayout(layout)
        


    def textChanged(self, text):
        print(text)

if __name__ == '__main__':
    app = QApplication(sys.argv)

    window = MyWindow()
    window.show()

    app.exec()